home *** CD-ROM | disk | FTP | other *** search
- package Code.FIELD
- {
- import Box2D.Collision.*;
- import Box2D.Collision.Shapes.*;
- import Box2D.Common.Math.b2Vec2;
- import Box2D.Dynamics.*;
- import Code.FIELD.body.*;
- import Code.FIELD.bonus._be635;
- import Code.FIELD.bonus._oo370;
- import Code.FIELD.contacts.*;
- import Code.FIELD.effects._lb628;
- import Code.FIELD.helpers.*;
- import Code.FIELD.interfaces.*;
- import Code.LIB.*;
- import flash.geom.Point;
-
- public class _pn539
- {
- public static const GRAVITY:Number = 12.5;
-
- public var PS:Number;
-
- public var iBodies:Array;
-
- public var iSize:Number;
-
- public var iRandom:_id116;
-
- private var iField:_dq803;
-
- public var iShapeType:TShapeType;
-
- public var iDisplay:_be548;
-
- public var iStop:Boolean = false;
-
- public var iShapes:Array;
-
- public var iExplodes:Array;
-
- public var iArtifactsC:_be548;
-
- public var iMaxColor:int;
-
- public var iContactSolver:_lf150;
-
- private var iBoxW:_fp437;
-
- public var iShakes:int = 3;
-
- private var iArtifacts:Array;
-
- public function _pn539(param1:_dq803, param2:TShapeType)
- {
- iRandom = new _id116(2,5);
- iShakes = 3;
- iStop = false;
- super();
- iField = param1;
- iShapeType = param2;
- iSize = iField.iLevel.shapeSize;
- iMaxColor = param1.iLevel.numColors - 1;
- PS = _dq803.PHYS_SCALE;
- init();
- }
-
- public function set stop(param1:Boolean) : void
- {
- iStop = param1;
- }
-
- public function _rc653(param1:_qh446) : _cl647
- {
- var _loc2_:_th791 = null;
- var _loc3_:_cl647 = null;
- _loc2_ = iBoxW._ea632(param1);
- _loc3_ = new _cl647(_loc2_,this);
- _loc3_.iBodyDef = param1;
- iBodies.push(_loc3_);
- iDisplay.addChild(_loc3_._ky348());
- return _loc3_;
- }
-
- private function init() : void
- {
- var _loc1_:_pv475 = null;
- var _loc2_:b2Vec2 = null;
- var _loc3_:Boolean = false;
- iBodies = new Array();
- iShapes = new Array();
- iArtifacts = new Array();
- _loc1_ = new _pv475();
- _loc1_.lowerBound._br741(-100,-100);
- _loc1_.upperBound._br741(1000,1000);
- _loc2_ = new b2Vec2(0,GRAVITY);
- _loc3_ = true;
- iBoxW = new _fp437(_loc1_,_loc2_,_loc3_);
- if(iShapeType == TShapeType.CIRCLE)
- {
- iContactSolver = new _pc806(this);
- }
- else
- {
- iContactSolver = new _rr109(this);
- }
- iDisplay = new _be548();
- iArtifactsC = new _be548();
- iDisplay.graphics.beginFill(0,0);
- iDisplay.graphics.drawRect(0,0,440,480);
- iDisplay.graphics.endFill();
- _iy267();
- _dc538();
- }
-
- public function _tp19(param1:b2Vec2) : void
- {
- var _loc2_:_be635 = null;
- _loc2_ = new _be635(400);
- iArtifacts.push(_loc2_);
- iArtifactsC.addChild(_loc2_);
- _loc2_._xe768(param1.x,param1.y);
- }
-
- public function _dj378(param1:b2Vec2) : _kc461
- {
- var _loc2_:_qh446 = null;
- var _loc3_:_cl647 = null;
- var _loc4_:_uy491 = null;
- var _loc5_:_hx306 = null;
- var _loc6_:_oo370 = null;
- _loc2_ = new _qh446();
- _loc2_.allowSleep = true;
- _loc2_.position._br741(param1.x / PS,param1.y / PS);
- _loc3_ = _rc653(_loc2_);
- _loc4_ = new _uy491();
- _loc4_.density = 0.3;
- _loc4_.friction = 0.3;
- _loc4_.restitution = 0.3;
- _loc4_.radius = 18 / PS;
- _loc5_ = _loc3_._ss177._vv93(_loc4_);
- _loc6_ = new _oo370(_loc3_,_loc5_,0);
- _loc6_.iShapeDef = _loc4_;
- _loc3_._aw415(_loc6_,0,0);
- _loc3_.display._wy690();
- _loc3_._ss177._sb691();
- return _loc6_;
- }
-
- public function _gy612(param1:_ny544) : void
- {
- param1._kx555(this);
- }
-
- public function _nx724(param1:_cl647) : void
- {
- if(!param1.display.parent)
- {
- return;
- }
- iDisplay.removeChild(param1.display);
- iBodies.splice(iBodies.indexOf(param1),1);
- iBoxW._md511(param1._ss177);
- param1._dx150();
- }
-
- public function onEnterFrame() : void
- {
- var _loc1_:int = 0;
- var _loc2_:_bw350 = null;
- if(iStop)
- {
- return;
- }
- iBoxW._gu529(1 / 30,10);
- _loc1_ = 0;
- while(_loc1_ < iBodies.length)
- {
- iBodies[_loc1_].onEnterFrame();
- _loc1_++;
- }
- _loc1_ = 0;
- while(_loc1_ < iArtifacts.length)
- {
- _loc2_ = iArtifacts[_loc1_];
- _loc2_.onEnterFrame();
- if(_loc2_._ao508)
- {
- iArtifacts.splice(_loc1_,1);
- _loc2_._dx150();
- _loc2_.display.parent.removeChild(_loc2_.display);
- }
- _loc1_++;
- }
- }
-
- public function _np605(param1:Number) : void
- {
- var _loc2_:Point = null;
- var _loc3_:int = 0;
- var _loc4_:_cl647 = null;
- var _loc5_:b2Vec2 = null;
- var _loc6_:int = 0;
- var _loc7_:Number = NaN;
- var _loc8_:b2Vec2 = null;
- _loc2_ = new Point(Math.random() * 10 - Math.random() * 10,-Math.random() * 7 - 3);
- _loc3_ = 0;
- while(_loc3_ < iBodies.length)
- {
- _loc4_ = iBodies[_loc3_];
- if(!_loc4_.isFalling)
- {
- _loc5_ = _kc461(_loc4_.iShapesList[0])._pg614();
- _loc5_.y *= PS;
- if(Math.abs(iField.iDeadLine - _loc5_.y) >= 120)
- {
- _loc6_ = int(_loc4_.iShapesList.length);
- _loc7_ = _loc4_.iB2Body._fj733();
- _loc2_.normalize(param1 * _loc7_ * 5);
- _loc8_ = new b2Vec2(_loc2_.x,_loc2_.y);
- _loc4_._ss177._dx743(_loc8_,_loc4_._ss177._yd753());
- }
- }
- _loc3_++;
- }
- }
-
- public function _xt729() : void
- {
- ++iShakes;
- iField.iBShake._xs48 = "shakes:" + iShakes;
- }
-
- private function _iy267() : void
- {
- var _loc1_:Array = null;
- var _loc2_:_qh446 = null;
- var _loc3_:_th791 = null;
- var _loc4_:int = 0;
- var _loc5_:Array = null;
- var _loc6_:_mo808 = null;
- var _loc7_:int = 0;
- _loc1_ = iField.iLevel.map.pool;
- _loc2_ = new _qh446();
- _loc3_ = iBoxW._ea632(_loc2_);
- _loc4_ = 0;
- while(_loc4_ < _loc1_.length)
- {
- _loc5_ = _loc1_[_loc4_];
- _loc6_ = new _mo808();
- _loc6_.vertexCount = _loc5_.length;
- _loc7_ = 0;
- while(_loc7_ < _loc5_.length)
- {
- _loc6_.vertices[_loc7_] = new b2Vec2(_loc5_[_loc7_].x / PS,_loc5_[_loc7_].y / PS);
- _loc7_++;
- }
- _loc3_._vv93(_loc6_);
- _loc4_++;
- }
- iDisplay.addChild(_wo607._qt54(_loc1_,iField.iLevel.map.deadLine));
- }
-
- public function _kv593(param1:_cl647) : void
- {
- iBodies.push(param1);
- iDisplay.addChild(param1._ky348());
- }
-
- private function _uf306(param1:Number, param2:Number, param3:int, param4:int) : void
- {
- var _loc5_:int = 0;
- var _loc6_:Array = null;
- var _loc7_:_lb628 = null;
- _loc5_ = Math.round(Math.random() * (iExplodes.length - 1));
- _loc6_ = this.iExplodes[_loc5_];
- _loc7_ = new _lb628(_loc6_,param3);
- _loc7_._vq458 = param1;
- _loc7_._vg471 = param2;
- this.iArtifactsC.addChild(_loc7_);
- this.iArtifacts.push(_loc7_);
- }
-
- public function _vo82() : int
- {
- var _loc1_:Array = null;
- var _loc2_:int = 0;
- _loc1_ = [0,1,2,3];
- _loc2_ = 2;
- return _loc1_[iRandom._qm468(_loc2_)];
- }
-
- public function _fp416() : Number
- {
- var _loc1_:Number = NaN;
- var _loc2_:int = 0;
- var _loc3_:_kc461 = null;
- var _loc4_:b2Vec2 = null;
- _loc1_ = 9999999;
- _loc2_ = 0;
- while(_loc2_ < iShapes.length)
- {
- _loc3_ = iShapes[_loc2_];
- if(!(_loc3_.body.isFalling || _loc3_ is _ny544))
- {
- _loc4_ = _loc3_._pg614();
- if(_loc4_.y < _loc1_)
- {
- _loc1_ = _loc4_.y;
- }
- }
- _loc2_++;
- }
- return _loc1_ * PS;
- }
-
- public function _vk641(param1:Point) : void
- {
- var _loc2_:Array = null;
- _loc2_ = [[1,1,0],[1,0,0],[1,1,0]];
- _vq741._rc653(this,new b2Vec2(param1.x,param1.y),_loc2_,iShapeType,12.5);
- }
-
- public function _xl179(param1:_cl647) : void
- {
- var _loc2_:Array = null;
- var _loc3_:Array = null;
- var _loc4_:int = 0;
- var _loc5_:_cl647 = null;
- var _loc6_:Array = null;
- var _loc7_:int = 0;
- var _loc8_:_kc461 = null;
- var _loc9_:_kc461 = null;
- _loc2_ = param1._if196;
- _nc381._cm181(_loc2_);
- if(_loc2_.length == 0)
- {
- _nx724(param1);
- return;
- }
- _loc3_ = _nc381._mu796(_loc2_,_kc461);
- if(_loc3_.length < 2)
- {
- return;
- }
- _nx724(param1);
- _loc4_ = 0;
- while(_loc4_ < _loc3_.length)
- {
- _loc5_ = _rc653(param1.iBodyDef);
- _loc6_ = _loc3_[_loc4_];
- _loc7_ = 0;
- while(_loc7_ < _loc6_.length)
- {
- _loc8_ = _loc6_[_loc7_];
- _loc9_ = _loc5_._kh570(_loc8_.iShapeDef,_loc8_.iI,_loc8_.iJ,_loc8_.color);
- _loc7_++;
- }
- _loc5_._ss177._cr169(param1._ss177._jq282(),param1._ss177._gm184());
- _loc5_.display._wy690();
- _loc5_._ss177._sb691();
- _loc4_++;
- }
- }
-
- public function _fq230(param1:Array) : void
- {
- var _loc2_:Array = null;
- var _loc3_:int = 0;
- var _loc4_:_kc461 = null;
- var _loc5_:b2Vec2 = null;
- var _loc6_:_cl647 = null;
- _loc2_ = new Array();
- _loc3_ = 0;
- while(_loc3_ < param1.length)
- {
- _loc4_ = param1[_loc3_];
- _loc5_ = _loc4_._pg614();
- _uf306(_loc5_.x * PS,_loc5_.y * PS,0,0);
- _loc3_++;
- }
- _loc3_ = 0;
- while(_loc3_ < param1.length)
- {
- _loc6_ = _kc461(param1[_loc3_]).body;
- _loc6_._mi548(param1[_loc3_]);
- if(_loc2_.indexOf(_loc6_) < 0)
- {
- _loc2_.push(_loc6_);
- }
- _loc3_++;
- }
- _loc3_ = 0;
- while(_loc3_ < _loc2_.length)
- {
- _loc6_ = _loc2_[_loc3_];
- if(_loc6_.iShapesList.length == 0)
- {
- _nx724(_loc6_);
- }
- else
- {
- _xl179(_loc6_);
- }
- _loc3_++;
- }
- }
-
- public function _dx150() : void
- {
- iShapes = null;
- iBodies = null;
- }
-
- public function _dc538() : void
- {
- var _loc1_:Array = null;
- var _loc2_:Array = null;
- var _loc3_:int = 0;
- _loc1_ = _wo607._kf49(3,15,12);
- iExplodes = new Array();
- _loc2_ = [16777215,16777215,16777215,16777215];
- _loc3_ = 0;
- while(_loc3_ < _loc2_.length)
- {
- iExplodes.push(_lb628._af81(_loc1_,10,_loc2_[_loc3_]));
- _loc3_++;
- }
- }
- }
- }
-
-